package com.yootk.listener;

import jakarta.servlet.annotation.WebListener;
import jakarta.servlet.http.HttpSessionEvent;
import jakarta.servlet.http.HttpSessionIdListener;

/**
 * 监听SessionID状态
 */
@WebListener
public class SessionChangeMonitor implements HttpSessionIdListener {

    @Override
    public void sessionIdChanged(HttpSessionEvent event, String oldSessionId) {
        System.out.println("【SessionChangeMonitor.sessionIdChanged()】新的SessionID = " + event.getSession().getId() + "、旧的SessionID = " + oldSessionId + "、Session属性：" + event.getSession().getAttribute("message"));
    }
}
